# 检测目标架构
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
    add_definitions(-DARCH_X86)
    message(STATUS "Building for x86 architecture")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")
    add_definitions(-DARCH_ARM)
    message(STATUS "Building for ARM architecture")
else()
    message(WARNING "Unknown architecture, using generic implementation")
endif()

# 添加架构特定源文件
if(ARCH_X86)
    set(ARCH_SOURCES 
        core/arch/x86/simd.c
        core/arch/x86/avx.c)
elseif(ARCH_ARM)
    set(ARCH_SOURCES
        core/arch/arm/neon.c
        core/arch/arm/sve.c)
endif()

# 构建核心库
add_library(core STATIC
    core/array.c
    core/matrix.c
    core/image.c
    core/dispatch.c
    ${ARCH_SOURCES})